<?php

/**
 * 删除收藏夹
 * 会将收藏夹里面的所有收藏的项目都删除掉
 *
 * 属性：
 *     id:收藏夹的id
 */
session_start();
require_once "./read.php";
$data = json_decode(file_get_contents("php://input"));
$user_id = $_SESSION['id'];
$data = array(
    "user_id"=>$user_id,
    "id"=>$data->id
);
if($post->Delete_Favorites($data)){
    $result = array(
        "status"=>200,
        "msg"=>"收藏夹删除成功"
    );
}else{
    $result = array(
        "status"=>201,
        "msg"=>"收藏夹删除失败"
    );
}
$res = json_encode($result,JSON_UNESCAPED_UNICODE);
echo $res;
return $res;